package 代理模式;

public class ProxyObject extends AbstractObject{
    private RealObject realObject;
    public ProxyObject() {
    }
    @Override
    public void operation() {
        preObject();
        if (realObject==null){
            realObject=new RealObject();
        }
        realObject.operation();
        postObject();
    }

    private void preObject() {
        System.out.println("调用代理模式前的操作");
    }
    private void postObject(){
        System.out.println("调用代理模式后的操作");
    }
}
